package com.xyy.saas.payment.cores.enums;

import java.util.Arrays;
import java.util.Map;
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;

/**
 * 京东支付 签约绑卡类型
 */
public enum JDPayContractTypeEnum {

    ONEKEYSIGN(1, "一键签约"),
    CONTRACTSIGN(2, "协议签约");

    private int code;
    private String desc;

    private static Map<Integer,JDPayContractTypeEnum> code2Enum;

    static {
        code2Enum = Arrays.asList(values()).stream().collect(Collectors.toMap(JDPayContractTypeEnum::getCode, UnaryOperator.identity()));
    }

    JDPayContractTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static JDPayContractTypeEnum getEnum(int code){
        return code2Enum.get(code);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

}
